# encoding: utf-8
# @author: __匸匿
"""
@license: 980980524@qq.com,
@contact: qq:980980524
@file: __init__.py.py
@time: 19-1-9 上午12:18
@desc:
"""
from flask import Blueprint, session, request, url_for, redirect

admin_blu = Blueprint("admin",__name__)

from . import views

@admin_blu.before_request
def check_admin():
    # if 不是管理员，跳转主页
    is_admin = session.get("is_admin",False)
    # if 当前访问的url 不是管理登陆界面
    if not is_admin and not request.url.endswith(url_for("admin.login")):
        return redirect('/')